<?php
class ZA_View_Helper_ReqnumberElement extends Zend_View_Helper_FormElement {
    
    protected $html = '';
    
    public function reqnumberElement($name, $value = null, $attribs = null)
    {
        $reqnum = $deptcode = $month = $year = '';
        $helper = new Zend_View_Helper_FormText;
        $helper->setView($this->view);

        extract($attribs);
        
        if(isset($disabled)) {
            $attribs = array('size' => 4, 'maxlength' => 4, 'disabled' => true);
        } else {
            $attribs = array('size' => 4, 'maxlength' => 4);
        }
        
        if($value)
        {
            list($reqnum, $deptcode, $month, $year) = split("/", $value);
        }
        
        $this->html .= $helper->formText($name.'[reqnum]', $reqnum, $attribs);
        $this->html .= $helper->formText($name.'[deptcode]',$deptcode, $attribs);
        $this->html .= $helper->formText($name.'[month]',$month, $attribs);
        $this->html .= $helper->formText($name.'[year]',$year, $attribs);
        
        return $this->html;
    }
}

